import React from 'react';
import ReactDOM from 'react-dom';
import {Router, Route, hashHistory, browserHistory, Link} from 'react-router';

import utils from '../js/utils';
let href = window.location.href;

if (href.indexOf("from=singlemessage") != -1) {
  let hash = window.location.hash;
  window.location.href = "https://ma.ke.juzizhi.cn/" + hash;
}

import App from '../jsx/common/App.jsx';
import Application from "../jsx/Application.jsx";
import User from "../jsx/User.jsx";
import Success from "../jsx/Success.jsx";

ReactDOM.render(
    <Router history={hashHistory}>
        <Route path='/' component={App}></Route>
    	<Route path='/:app_id' component={Application}></Route>
        <Route path='/:app_id/:unionid' component={Application}></Route>
        <Route path='/' component={Application}>
            <Route path='/user/:unionid' component={User}></Route>
            <Route path='/success/:app_id/:unionid' component={Success}></Route>
        </Route>
    </Router>
, document.getElementById('app'));
